<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 请把俩个数组[A1, A2, B1, B2, C1, C2, D1, D2] 和[A, B, C, D]，
        // 合并为[A1, A2, A, B1, B2, B, C1, C2, C, D1, D2, D]。
        var arr1 = ['A1', 'A2', 'B1', 'B2', 'C1', 'C2', 'D1', 'D2'];
        var arr2 = ['A', 'B', 'C', 'D'];
        // for(i = 0;i<=arr1.length-1;i+=2){
        //     var result = arr1.slice(i,i+2);
        // }
        var result1 = arr1.slice(0, 2);
        var result2 = arr1.slice(2, 4);
        var result3 = arr1.slice(4, 6);
        var result4 = arr1.slice(6);
        result1.push(arr2[0]);
        result2.push(arr2[1]);
        result3.push(arr2[2]);
        result4.push(arr2[3]);
        var total = result1.concat(result2, result3, result4);
        console.log(total);


    </script>




</body>

</html>